﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="frmReporteVentasxOperador.aspx.cs" Inherits="pryCallCenter.Procesos.RegistroVentas.frmRegistroVentasxOperador" %>

<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxRoundPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxHiddenField" TagPrefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .periodo
        {
            width: 90%;
        }
        .style3
        {
            margin-left: 36%;
            font-size: 16px;
        }
        .style5
        {
            width: 98% !important;
        }
        .style8
        {
            padding-right: 2.1em;
        }
        .style9
        {
            width: 708px;
        }
        .txtTotal
        {
            text-align: right;
        }
        #cont1
        {
            width: 45%;
            float: left;
        }
        #cont2
        {
            width: 45%;
            float: right;
        }
        #cont3
        {
            width: 100%;
            clear: both;
        }
        .fila1
        {
            padding: 0.5em 0;
        }
        .fila2
        {
            padding: 0.625em 0;
        }
        .btnCerrar
        {
            width: 5px !important;
            height: 5px !important;
            padding: -3px -8px -4px !important;
        }
        .btnCerrar img
        {
            width: 12.5px !important;
            height: 12.5px !important;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" Width="100%" HeaderText="Reporte de Ventas">
        <PanelCollection>
            <dx:PanelContent>
                <div class="CssHeader">
                    <div align="center" class="CssTitle4">
                        REPORTE DE VENTAS
                    </div>
                    <div class="CssRigth">
                        <dx:ASPxPanel ID="ASPxPanel1" runat="server" Width="100%">
                            <PanelCollection>
                                <dx:PanelContent>
                                    <table class="style1">
                                        <tr>
                                            <td class="style1">
                                                Usuario:
                                            </td>
                                            <td>
                                                <dx:ASPxTextBox ID="txtUsuario" runat="server" Width="170px">
                                                </dx:ASPxTextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Fecha de Reporte:
                                            </td>
                                            <td>
                                                <dx:ASPxDateEdit ID="dtpFecha" runat="server">
                                                </dx:ASPxDateEdit>
                                            </td>
                                        </tr>
                                    </table>
                                </dx:PanelContent>
                            </PanelCollection>
                        </dx:ASPxPanel>
                    </div>
                </div>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <div class="CssCuerpo">
                            <div id="cont1">
                                <table class="style1">
                                    <tr>
                                        <td class="fila1">
                                            Operador
                                        </td>
                                        <td class="fila1">
                                            <dx:ASPxTextBox ID="txtnomOperador" runat="server" Width="170px" ReadOnly="True" HorizontalAlign="Left">
                                            </dx:ASPxTextBox>
                                        </td>
                                        <td>
                                            <dx:ASPxButton ID="btnBorrarFiltroOperador" runat="server" Image-Url="~/img/cerrar.jpg" AutoPostBack="false" Width="150px" CssClass="btnCerrar" OnClick="BorrarFiltroOperador">
                                            </dx:ASPxButton>
                                        </td>
                                        <td class="fila1">
                                            <dx:ASPxButton ID="btnBuscarOperador" runat="server" Text="Buscar Operador" AutoPostBack="false" Width="150px">
                                                <ClientSideEvents Click="function(s, e) {pcBuscarOperador.Show();}" />
                                            </dx:ASPxButton>
                                        </td>
                                        <td class="fila1">
                                            <dx:ASPxTextBox ID="hid_codOperador" runat="server" Width="1px" ReadOnly="True" HorizontalAlign="Left" Visible="false">
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="fila1">
                                            Producto
                                        </td>
                                        <td class="fila1">
                                            <dx:ASPxTextBox ID="txtnomProducto" runat="server" Width="170px" ReadOnly="True" HorizontalAlign="Left">
                                            </dx:ASPxTextBox>
                                        </td>
                                        <td>
                                            <dx:ASPxButton ID="btnBorrarFiltroProducto" runat="server" Image-Url="~/img/cerrar.jpg" AutoPostBack="false" Width="150px" CssClass="btnCerrar" OnClick="BorrarFiltroProducto">
                                            </dx:ASPxButton>
                                        </td>
                                        <td class="fila1">
                                            <dx:ASPxButton ID="btnBuscarProducto" runat="server" Text="Buscar Producto" AutoPostBack="false" Width="150px">
                                                <ClientSideEvents Click="function(s, e) {pcBuscarProducto.Show();}" />
                                            </dx:ASPxButton>
                                        </td>
                                        <td class="fila1">
                                            <dx:ASPxTextBox ID="hid_codProducto" runat="server" Width="1px" ReadOnly="True" HorizontalAlign="Left" Visible="false">
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="fila1">
                                            Cliente
                                        </td>
                                        <td class="fila1">
                                            <dx:ASPxTextBox ID="txtnomCliente" runat="server" Width="170px" ReadOnly="True" HorizontalAlign="Left">
                                            </dx:ASPxTextBox>
                                        </td>
                                        <td>
                                            <dx:ASPxButton ID="btnBorrarFiltroCliente" runat="server" Image-Url="~/img/cerrar.jpg" AutoPostBack="false" Width="150px" CssClass="btnCerrar" OnClick="BorrarFiltroCliente">
                                            </dx:ASPxButton>
                                        </td>
                                        <td class="fila1">
                                            <dx:ASPxButton ID="btnBuscarCliente" runat="server" Text="Buscar Cliente" AutoPostBack="false" Width="150px">
                                                <ClientSideEvents Click="function(s, e) {pcBuscarCliente.Show();}" />
                                            </dx:ASPxButton>
                                        </td>
                                        <td class="fila1">
                                            <dx:ASPxTextBox ID="hid_codCliente" runat="server" Width="1px" ReadOnly="True" HorizontalAlign="Left" Visible="false">
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4" align="center" class="fila1">
                                            <dx:ASPxButton ID="btnGenerarReporte" runat="server" Text="Generar Reporte" AutoPostBack="False" OnClick="GenerarReporte" Width="75%">
                                            </dx:ASPxButton>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div id="cont2">
                                <table class="style1">
                                    <tr>
                                        <td class="fila2">
                                            Estado
                                        </td>
                                        <td class="fila2">
                                            <dx:ASPxComboBox ID="cboEstado" runat="server" SelectedIndex="0">
                                                <Items>
                                                    <dx:ListEditItem Selected="True" Text="Todos" Value="" />
                                                    <dx:ListEditItem Text="Registrado" Value="RG" />
                                                    <dx:ListEditItem Text="Aprobado" Value="AP" />
                                                    <dx:ListEditItem Text="Anulado" Value="AN" />
                                                    <dx:ListEditItem Text="Cancelado" Value="CN" />
                                                </Items>
                                            </dx:ASPxComboBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="fila2">
                                            Fecha Inicial
                                        </td>
                                        <td class="fila2">
                                            <dx:ASPxDateEdit ID="dtpDesde" runat="server">
                                            </dx:ASPxDateEdit>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="fila2">
                                            Fecha Final
                                        </td>
                                        <td class="fila2">
                                            <dx:ASPxDateEdit ID="dtpHasta" runat="server">
                                            </dx:ASPxDateEdit>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div id="cont3">
                                <table class="style1">
                                    <tr>
                                        <td colspan="2">
                                            <span class="style3">Reporte de Ventas</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <dx:ASPxGridView ID="dgvReporteVentas" runat="server" AutoGenerateColumns="False" Width="100%" CssClass="style5" KeyFieldName="nropedido">
                                                <Columns>
                                                    <dx:GridViewDataTextColumn Caption="Fecha" FieldName="fecha" VisibleIndex="0">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn Caption="No. de Pedido" FieldName="nropedido" VisibleIndex="1">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn Caption="Cliente" FieldName="cliente" VisibleIndex="2">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn Caption="Producto / Servicio" FieldName="productoservicio" VisibleIndex="3">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn Caption="Cantidad" FieldName="cantidad" VisibleIndex="4">
                                                    </dx:GridViewDataTextColumn>
                                                    <dx:GridViewDataTextColumn Caption="Precio" FieldName="precio" VisibleIndex="5">
                                                    </dx:GridViewDataTextColumn>
                                                </Columns>
                                                <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" />
                                                <Settings ShowGroupPanel="True" />
                                            </dx:ASPxGridView>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" class="style9">
                                            Total &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        </td>
                                        <td style="width: 70px">
                                            <dx:ASPxTextBox ID="txtTotal" runat="server" Width="100px" HorizontalAlign="Right" ReadOnly="True">
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                    <tr style="height: 55px;">
                                        <td align="right" class="style8" colspan="2">
                                            <dx:ASPxButton ID="btnImprimir" runat="server" Text="Imprimir" AutoPostBack="false" Width="100px">
                                            </dx:ASPxButton>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <div id="PopPup">
                            <dx:ASPxPopupControl ID="pcMensaje" runat="server" ClientInstanceName="pcMensaje" HeaderText="Mensaje" Width="350px" CloseAction="CloseButton" AllowDragging="True" EnableTheming="True" Modal="True" PopupHorizontalAlign="WindowCenter"
                                PopupVerticalAlign="WindowCenter" AllowResize="True" DragElement="Window">
                                <HeaderStyle>
                                    <Paddings PaddingLeft="30px" />
                                    <BackgroundImage HorizontalPosition="10px" ImageUrl="~/img/iconError.png" Repeat="NoRepeat" />
                                </HeaderStyle>
                                <ContentCollection>
                                    <dx:PopupControlContentControl>
                                        <table class="style1">
                                            <tr>
                                                <td align="center">
                                                    <dx:ASPxLabel ID="lblMensaje" runat="server">
                                                    </dx:ASPxLabel>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="center">
                                                    <div style="padding: 15px 0 0 0;">
                                                        <dx:ASPxButton ID="btnPopUpAceptar" runat="server" Text="Aceptar" Width="100px" AutoPostBack="False">
                                                            <ClientSideEvents Click="function(s, e) {pcMensaje.Hide();}" />
                                                        </dx:ASPxButton>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </dx:PopupControlContentControl>
                                </ContentCollection>
                            </dx:ASPxPopupControl>
                            <dx:ASPxPopupControl ID="pcBuscarOperador" runat="server" ClientInstanceName="pcBuscarOperador" HeaderText="Buscar Operador" Width="800px" CloseAction="CloseButton" AllowDragging="True" EnableTheming="True"
                                Modal="True" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
                                <ContentCollection>
                                    <dx:PopupControlContentControl>
                                        <table class="style1">
                                            <tr>
                                                <td>
                                                    <dx:ASPxGridView ID="dgvOperador" runat="server" Width="100%" KeyFieldName="CodigoPersona" ClientInstanceName="dgvOperador" AutoGenerateColumns="False">
                                                        <Columns>
                                                            <dx:GridViewCommandColumn ShowInCustomizationForm="True" VisibleIndex="0">
                                                                <ClearFilterButton Visible="True">
                                                                </ClearFilterButton>
                                                            </dx:GridViewCommandColumn>
                                                            <dx:GridViewDataTextColumn Caption="Codigo" FieldName="CodigoPersona" VisibleIndex="1">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="Ape. Paterno" FieldName="ApellidoPaterno" VisibleIndex="2">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="Ape. Materno" FieldName="ApellidoMaterno" VisibleIndex="3">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="Nombre" FieldName="Nombres" VisibleIndex="4">
                                                            </dx:GridViewDataTextColumn>
                                                        </Columns>
                                                        <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" />
                                                        <Settings ShowFilterRow="True" />
                                                    </dx:ASPxGridView>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <div style="float: left; padding-left: 10px">
                                                        <dx:ASPxButton ID="btnAceptar" runat="server" Text="Aceptar" Width="100px" OnClick="AgregarOperador">
                                                            <ClientSideEvents Click="function(s, e) {pcBuscarOperador.Hide();}" />
                                                        </dx:ASPxButton>
                                                    </div>
                                                    <div style="float: left; padding-left: 10px">
                                                        <dx:ASPxButton ID="btnCancelar" runat="server" Text="Cancelar" Width="100px" AutoPostBack="False">
                                                            <ClientSideEvents Click="function(s, e) {pcBuscarOperador.Hide();}" />
                                                        </dx:ASPxButton>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </dx:PopupControlContentControl>
                                </ContentCollection>
                            </dx:ASPxPopupControl>
                            <dx:ASPxPopupControl ID="pcBuscarCliente" runat="server" ClientInstanceName="pcBuscarCliente" HeaderText="Buscar Cliente" Width="800px" CloseAction="CloseButton" AllowDragging="True" EnableTheming="True"
                                Modal="True" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
                                <ContentCollection>
                                    <dx:PopupControlContentControl ID="PopupControlContentControl1" runat="server" SupportsDisabledAttribute="True">
                                        <table class="style1">
                                            <tr>
                                                <td>
                                                    <dx:ASPxGridView ID="dgvClientes" runat="server" Width="100%" KeyFieldName="CodigoPersona" ClientInstanceName="dgvClientes" AutoGenerateColumns="False">
                                                        <Columns>
                                                            <dx:GridViewCommandColumn ShowInCustomizationForm="True" VisibleIndex="0">
                                                                <ClearFilterButton Visible="True">
                                                                </ClearFilterButton>
                                                            </dx:GridViewCommandColumn>
                                                            <dx:GridViewDataTextColumn Caption="CODIGO" FieldName="CodigoPersona" VisibleIndex="1">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="APE. PATERNO" FieldName="ApellidoPaterno" VisibleIndex="2">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="APE. MATERNO" FieldName="ApellidoMaterno" VisibleIndex="3">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="NOMBRE" FieldName="Nombres" VisibleIndex="4">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="DOCUMENTO" FieldName="NumeroDocumento" VisibleIndex="5">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="DIRECCION" FieldName="Direccion" VisibleIndex="8">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="TELEFONO" FieldName="Telefono" VisibleIndex="7">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="ESTADO" FieldName="Estado" VisibleIndex="9">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="CUENTA" FieldName="Cliente.CuentaBancaria" ShowInCustomizationForm="True" VisibleIndex="6">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="CORREO" FieldName="Correo" ShowInCustomizationForm="True" VisibleIndex="9">
                                                            </dx:GridViewDataTextColumn>
                                                        </Columns>
                                                        <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" />
                                                        <Settings ShowFilterRow="True" />
                                                    </dx:ASPxGridView>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <div style="float: left; padding-left: 10px">
                                                        <dx:ASPxButton ID="ASPxButton1" runat="server" Text="Aceptar" Width="100px" OnClick="AgregarCliente">
                                                            <ClientSideEvents Click="function(s, e) {pcBuscarCliente.Hide();}" />
                                                        </dx:ASPxButton>
                                                    </div>
                                                    <div style="float: left; padding-left: 10px">
                                                        <dx:ASPxButton ID="ASPxButton2" runat="server" Text="Cancelar" Width="100px" AutoPostBack="False">
                                                            <ClientSideEvents Click="function(s, e) {pcBuscarCliente.Hide();}" />
                                                        </dx:ASPxButton>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </dx:PopupControlContentControl>
                                </ContentCollection>
                            </dx:ASPxPopupControl>
                            <dx:ASPxPopupControl ID="pcBuscarProducto" runat="server" ClientInstanceName="pcBuscarProducto" HeaderText="Seleccionar Producto" Width="900px" CloseAction="CloseButton" AllowDragging="True" EnableTheming="True"
                                Modal="True" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
                                <ContentCollection>
                                    <dx:PopupControlContentControl ID="PopupControlContentControl2" runat="server" SupportsDisabledAttribute="True">
                                        <table class="style1">
                                            <tr>
                                                <td>
                                                    <dx:ASPxGridView ID="dgvProducto" runat="server" Width="100%" KeyFieldName="CodigoProducto" ClientInstanceName="dgvProducto" AutoGenerateColumns="False">
                                                        <Columns>
                                                            <dx:GridViewCommandColumn ShowInCustomizationForm="True" VisibleIndex="0" Width="20px">
                                                                <ClearFilterButton Visible="True">
                                                                </ClearFilterButton>
                                                            </dx:GridViewCommandColumn>
                                                            <dx:GridViewDataTextColumn Caption="CODIGO" FieldName="CodigoProducto" VisibleIndex="1">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="DESCRIPCIÓN" FieldName="Descripcion" VisibleIndex="2">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="PRECIO" FieldName="PrecioVenta" VisibleIndex="3">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="COMISION" FieldName="ComisionEmpresa" VisibleIndex="4">
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn Caption="ESTADO" FieldName="Estado" VisibleIndex="5" Visible="false">
                                                            </dx:GridViewDataTextColumn>
                                                        </Columns>
                                                        <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" />
                                                        <Settings ShowFilterRow="True" />
                                                    </dx:ASPxGridView>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="center">
                                                    <table>
                                                        <tr>
                                                            <td>
                                                                <div style="float: left; padding-left: 10px">
                                                                    <dx:ASPxButton ID="btnAceptarProducto" runat="server" Text="Aceptar" Width="100px" OnClick="AgregarProducto">
                                                                        <ClientSideEvents Click="function(s, e) {pcBuscarProducto.Hide();}" />
                                                                    </dx:ASPxButton>
                                                                </div>
                                                                <div style="float: left; padding-left: 10px">
                                                                    <dx:ASPxButton ID="btnCancelarProducto" runat="server" Text="Cancelar" Width="100px" AutoPostBack="False">
                                                                        <ClientSideEvents Click="function(s, e) {pcBuscarProducto.Hide();}" />
                                                                    </dx:ASPxButton>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </dx:PopupControlContentControl>
                                </ContentCollection>
                            </dx:ASPxPopupControl>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </dx:PanelContent>
        </PanelCollection>
    </dx:ASPxRoundPanel>
</asp:Content>
